﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace XServer.Filters
{
    /// <summary>
    /// 过滤器示例
    /// 
    /// 可注册服务，也可直接使用特性
    /// </summary>
    public class DemoFilter : Attribute, IActionFilter
    {
        public void OnActionExecuting(ActionExecutingContext context)
        {
            // Action 执行前操作
        }

        public void OnActionExecuted(ActionExecutedContext context)
        {
            // Action 执行后操作
            //context.HttpContext.Response.Headers["Content-Type"] = "text/html";
        }
    }
}
